﻿/*
**贷款处理页面
*/
Chenxin.UI.DealLoanPage = Chenxin.extend(Chenxin.UI.AddPageCommon,{
    actionUrl:"/service/logic/DealLoan.ashx",
    createForm:function(){
        return new Chenxin.UI.DealLoanForm({
            scope:this
        });
    },
    customerInit:function(){
    },
    initEvent:function(){
        var objPg = this;
        /*************事件：提交*************/
        $("#aSubmit").click(function(){
            if(objPg.form.DealLoanInfo == undefined || objPg.form.DealLoanInfo.RecordId == undefined || objPg.form.DealLoanInfo.RecordId == "00000000-0000-0000-0000-000000000000"){
                objPg.form.op = "inputsl";
            }
            else{
                objPg.form.op = "updatesl";
            }
            objPg.form.save();
            
            return false;
        });
        /*************事件：关闭*************/
        $("#aClose").click(function(){
            window.close();
            return false;
        });
    }
});

/*
**贷款处理窗体
*/
Chenxin.UI.DealLoanForm = Chenxin.extend(Chenxin.UI.AddFormCommon,{
    actionUrl:"/service/logic/DealLoan.ashx",
    id:"divDealLoan",
    createComboList:function(){
        var jsonInitVal = this.initComboVal();
        /****************************受理人输入信息*************************/
        //竣工日期
        var comboCompleteYear = new Chenxin.UI.BuildingYearCombo({
            containerId: '#CompleteYear',
            tbxWidth: 94,
            required:true,
            initValue:jsonInitVal.CompleteYear
        });
        //受理银行
//        var comboReceiveBank= new Chenxin.UI.Combo({
//            containerId: '#ReceiveBank',
//            name: 'ReceiveBank',
//            tbxWidth: 120,
//            colWidth:80,
//            required:true,
//            initValue:jsonInitVal.ReceiveBank,
//            items:comboCommon.BankInfo
//        });
        //评估公司
//        var comboEvaluateCorp= new Chenxin.UI.Combo({
//            containerId: '#EvaluateCorp',
//            name: 'EvaluateCorp',
//            tbxWidth: 120,
//            colWidth:80,
//            initValue:jsonInitVal.EvaluateCorp,
//            items:comboCommon.EvaluateCorp
//        });
        //保险公司
        var comboInsuranceCorp= new Chenxin.UI.Combo({
            containerId: '#InsuranceCorp',
            name: 'InsuranceCorp',
            tbxWidth: 35,
            colWidth:80,
            initValue:jsonInitVal.InsuranceCorp,
            items:comboCommon.InsuranceCorp
        });
        //贷款办理渠道
        var comboLoanDealMode= new Chenxin.UI.Combo({
            containerId: '#LoanDealMode',
            name: 'LoanDealMode',
            tbxWidth: 94,
            colWidth:80,
            required:true,
            initValue:jsonInitVal.LoanDealMode,
            items:comboCommon.LoanDealMode
        });
        //贷款签约地点
        var comboOrderPlace= new Chenxin.UI.Combo({
            containerId: '#OrderPlace',
            name: 'OrderPlace',
            tbxWidth: 94,
            colWidth:100,
            required:true,
            initValue:jsonInitVal.OrderPlace,
            items:comboCommon.OrderPlace
        });
        //贷款类型
        var comboLoanInfo= new Chenxin.UI.Combo({
            containerId: '#LoanInfo',
            name: 'LoanInfo',
            tbxWidth: 94,
            colWidth:80,
            required:true,
            items:comboCommon.LoanSLInfo
        });
        //原贷款银行
        var comboOldLoanBank= new Chenxin.UI.Combo({
            containerId: '#OldLoanBank',
            name: 'OldLoanBank',
            tbxWidth: 94,
            colWidth:80,
            initValue:jsonInitVal.OldLoanBank,
            items:comboCommon.BankInfo
        });
        //门店
        var comboEmpDepartId = new Chenxin.UI.StructCombo({
			param:{op:'getcontroldeparts'},
			containerId: '#EmpDepartId',
			name:'EmpDepartId',
			inModelType:'all',
			txtModelName:'EmpDepartName',
			required:true,
			tbxWidth: 94,
			colWidth:200,
			hasPage: true,
            hasSearch: true,
			initValue:jsonInitVal.EmpDepartId,
			onSelected:function(){
				if( this.getValue() != this.defVal ){
					comboEmployeeId.loadUser(this.getValue());
				}
			},
			afterSetValue:function(newVal,oldVal){
			    if( newVal != "请选择" ){
			       comboEmployeeId.loadUser(newVal);
				}
			}
		});
		//业务员
		var comboEmployeeId =new Chenxin.UI.RichModelTreeCombo({
            textBoxId:'txtEmployeeId',
            containerId:'#txtEmployeeId',
            inModelType:'all',
			txtModelName:'EmployeeName',
            required:true,
            singleSelect:true,
			name:'EmployeeId'
        });
        //return [comboCompleteYear,comboReceiveBank,comboEvaluateCorp,comboLoanDealMode,comboInsuranceCorp,comboOrderPlace,comboLoanInfo,comboOldLoanBank,comboEmpDepartId,comboEmployeeId];
        return [comboCompleteYear,comboLoanDealMode,comboInsuranceCorp,comboOrderPlace,comboLoanInfo,comboOldLoanBank,comboEmpDepartId,comboEmployeeId];
    },
    //文本框初始
    initFormValidator:function(){
    
        /****************************受理人输入*************************/
//        //成交编号
//        $("#ContractCode").formValidator({
//            validatorgroup: this.id,
//            onshow: "请输入成交编号！",
//            onfocus: "",
//            oncorrect: " "
//        }).inputValidator({ 
//            min: 1,
//            empty: {
//                leftempty: false,
//                rightempty: false,
//                emptyerror: "请输入成交编号！"
//            },
//            onerror: "请输入成交编号！"
//        });
        
        //合同价格
        $("#SalePrice_T").formValidator({
            validatorgroup: this.id,
            onshow: "请输入合同价格！",
            onfocus: "单位：万元",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "请输入合同价格！"
            },
            onerror: "请输入合同价格！"
        });
        
        //房源地址
        $("#Address").formValidator({
            validatorgroup: this.id,
            onshow: "请输入房源地址！",
            onfocus: "",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "请输入房源地址！"
            },
            onerror: "请输入房源地址！"
        });
        
        //评估价
        $("#EstimatePrice").formValidator({
            validatorgroup: this.id,
            onshow: "请输入评估价！",
            onfocus: "单位：万元",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "请输入评估价！"
            },
            onerror: "请输入评估价！"
        });
        
        //面积
        $("#BuildingArea").formValidator({
            validatorgroup: this.id,
            onshow: "请输入面积！",
            onfocus: "",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "请输入面积！"
            },
            onerror: "请输入面积！"
        });
        
        //总楼层
        $("#Total_Floor").formValidator({
            validatorgroup: this.id,
            onshow: "请输入总楼层！",
            onfocus: "",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "请输入总楼层！"
            },
            onerror: "请输入总楼层！"
        });
        
        //主贷人姓名
        $("#CustomerName").formValidator({
            validatorgroup: this.id,
            onshow: "请输入主贷人姓名！",
            onfocus: "",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "请输入主贷人姓名！"
            },
            onerror: "请输入主贷人姓名！"
        });
        //贷款人身份证
        $("#IDNum").formValidator({
            validatorgroup: this.id,
            onshow: "请输入上家身份证号！",
            onfocus: "上家身份证号为必输项",
            oncorrect: " "
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "上家身份证号不能为空！"
            },
            onerror: "上家身份证号不能为空！"
//        }).functionValidator({
//            fun: function(val, elem) {
//                return val.isIdCardNo();
//            },
//            onerror: "身份证格式不正确！"
        });
        
        //业务员
        $("#txtEmpolyeeId").formValidator({
            validatorgroup: this.id,
            onshow: "请输入业务员！",
            onfocus: "业务员为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "业务员不能为空！"
            },
            onerror: "业务员不能为空！"
        });
        
        //缺件内容
//        $("#LackInfo").formValidator({
//            validatorgroup: this.id,
//            onshow: "请输入缺件内容！",
//            onfocus: "缺件内容为必输项",
//            oncorrect: " "
//        }).inputValidator({ 
//            min: 1,
//            empty: {
//                leftempty: false,
//                rightempty: false,
//                emptyerror: "缺件内容不能为空！"
//            },
//            onerror: "缺件内容不能为空！"
//        });
    },
    afterGetFormJson:function(json){
        var JsonList = [];
        var trJson = {};
        this.form.additionalParam = {};

        //成交编号年份以CodeYear传到后台
        trJson["CodeYear"] = $("#CodeYear").val();
        if (trJson.toString() != "{}") {
            JsonList.push(trJson);
        }
        if (JsonList.toString() != "") {
            this.form.additionalParam.CodeYear = JsonList.toString();
        }
        
        //赋值
        if(json.IsNoEvaluateFee != undefined && json.IsNoEvaluateFee == "true"){
            json.IsNoEvaluateFee = true;
        }
        else{
            json.IsNoEvaluateFee = false;
        }
        if(json.IdBankReceipt != undefined && json.IdBankReceipt == "true"){
            json.IdBankReceipt = true;
        }
        else{
            json.IdBankReceipt = false;
        }
        if(json.IdZhuanBen != undefined && json.IdZhuanBen == "true"){
            json.IdZhuanBen = true;
        }
        else{
            json.IdZhuanBen = false;
        }
        if(json.IsNoAgencyFee != undefined && json.IsNoAgencyFee == "true"){
            json.IsNoAgencyFee = true;
        }
        else{
            json.IsNoAgencyFee = false;
        }
        if(json.IdShouBen != undefined && json.IdShouBen == "true"){
            json.IdShouBen = true;
        }
        else{
            json.IdShouBen = false;
        }
        if(json.Receipt != undefined && json.Receipt == "true"){
            json.Receipt = true;
        }
        else{
            json.Receipt = false;
        }
        if(json.Mortgage != undefined && json.Mortgage == "true"){
            json.Mortgage = true;
        }
        else{
            json.Mortgage = false;
        }
        
        //删除不用的控件
        delete json.ComCode;
        delete json.CodeYear;
    },
    saveSucc:function(){
        //提交成功后转到查询页面
        //window.location.href = "/page/Preliminary_Info/ShowListLoan.aspx";
        window.close();
    },
    loadLoan: function() {
        var _this = this;
        Chenxin.ajax({
            type: "get",
            dataType: "text",
            paramType: 'json',
            async:false,
            url: '/service/logic/DealLoan.ashx',
            data: { op: 'getmodel', modelid: this.currentId },
            onSuccess: function(data, msg) {
                if (data) {
                    _this.DealLoanInfo = data;
                }
            }
        });
    },
    initForm:function(){
        var varDate = new Date();
        //预审信息
        if($("#ctl00_main_hidPreliminaryInfo").val() != "" && $("#ctl00_main_hidPreliminaryInfo").val() != "null"){
            var preliminaryInfo = eval("(" + $("#ctl00_main_hidPreliminaryInfo").val() + ")");
            this.currentId = preliminaryInfo.RecordId;
        }
        if(this.currentId != undefined && this.currentId != null && this.currentId != "")
        {
            this.loadLoan();
        }
        
        if($("#ctl00_main_hidLoanInfo").val() != ""){
            var LoanInfo = eval("(" + $("#ctl00_main_hidLoanInfo").val() + ")");
            this.DealLoanInfo = LoanInfo;
        }
        
        if(this.DealLoanInfo == undefined)
        {
            if($("#ctl00_main_hidPreliminaryInfo").val() != "" && $("#ctl00_main_hidPreliminaryInfo").val() != "null")
            {
                var preliminaryInfo = eval("(" + $("#ctl00_main_hidPreliminaryInfo").val() + ")");
                this.DealLoanInfo = preliminaryInfo;
                this.DealLoanInfo.MainId = preliminaryInfo.RecordId;
                this.DealLoanInfo.ContractId = preliminaryInfo.ContractId;
                this.DealLoanInfo.Address = preliminaryInfo.Address;
                this.DealLoanInfo.SalePrice_T = preliminaryInfo.SalePrice_T;
                this.DealLoanInfo.ContractCode = preliminaryInfo.ContractCode;
                this.DealLoanInfo.EstimatePrice = preliminaryInfo.EstimatePrice;
                this.DealLoanInfo.BuildingArea = preliminaryInfo.BuildingArea;
                this.DealLoanInfo.CompleteYear = preliminaryInfo.CompleteYear;
                this.DealLoanInfo.Total_Floor = preliminaryInfo.Total_Floor;
                this.DealLoanInfo.LoanInfo = preliminaryInfo.LoanInfo;
                this.DealLoanInfo.ReceiveBank = preliminaryInfo.OrderBank;
                this.DealLoanInfo.SYMoney = preliminaryInfo.SYMoney;
                this.DealLoanInfo.SYYear = preliminaryInfo.SYYear;
                this.DealLoanInfo.GJJmoney = preliminaryInfo.GJJmoney;
                this.DealLoanInfo.GJJyear = preliminaryInfo.GJJyear;
                this.DealLoanInfo.OrderPlace = preliminaryInfo.OrderPlace;
                this.DealLoanInfo.Receipt = preliminaryInfo.Receipt;
                this.DealLoanInfo.Mortgage = preliminaryInfo.Mortgage;
                this.DealLoanInfo.SaleName = preliminaryInfo.SaleName;
                this.DealLoanInfo.SaleIDCard = preliminaryInfo.SaleIDCard;
                this.DealLoanInfo.OldLoanBank = preliminaryInfo.OldLoanBank;
                this.DealLoanInfo.OldLoanMoney = preliminaryInfo.OldLoanMoney;
                this.DealLoanInfo.OldRestMoney = preliminaryInfo.OldRestMoney;
                this.DealLoanInfo.EmpCompanyId = preliminaryInfo.AppCompanyId;
                this.DealLoanInfo.EmpCompanyName = preliminaryInfo.AppCompanyName;
                this.DealLoanInfo.EmpDepartId = preliminaryInfo.AppDepartId;
                this.DealLoanInfo.EmpDepartName = preliminaryInfo.AppDepartName;
                this.DealLoanInfo.EmployeeId = preliminaryInfo.AppEmployeeId;
                this.DealLoanInfo.EmployeeName = preliminaryInfo.AppEmployeeName;
                this.DealLoanInfo.EmpPhone = preliminaryInfo.EmpPhone;
                this.DealLoanInfo.Remark = preliminaryInfo.Remark;
                this.currentId = preliminaryInfo.RecordId;
                this.DealLoanInfo.RecordId = null;
                this.DealLoanInfo.CodeYear = varDate.getFullYear().toString().substring(2);
                
                 //贷款人信息
                if($("#ctl00_main_hidPreBuyerInfo").val() != "")
                {
                    var preBuyerInfo = eval("(" + $("#ctl00_main_hidPreBuyerInfo").val() + ")");
                    this.DealLoanInfo.CustomerName = preBuyerInfo.CustomerName;
                    this.DealLoanInfo.IDNum = preBuyerInfo.IDNum;
                }
            }
            var myDate = new Date();
            function getDate(myDate)   
            {   
                var thisYear = myDate.getYear();   
                var thisMonth = myDate.getMonth() + 1;   
                //如果月份长度是一位则前面补0   
                if(thisMonth<10) thisMonth = "0" + thisMonth;   
                
                var thisDay = myDate.getDate();   
                //如果天的长度是一位则前面补0   
                if(thisDay<10) thisDay = "0" + thisDay;
                 
                return thisYear + "-" + thisMonth + "-" + thisDay;   
            } 

            this.DealLoanInfo.EvaluateFeeDate = getDate(myDate);
            this.DealLoanInfo.AgencyFeeDate = getDate(myDate);
            this.DealLoanInfo.LoanContractDate = getDate(myDate);
        }
        else
        {
            var strCode = this.DealLoanInfo.ContractCode.split('-');
            if(strCode.length>1)
            {
                this.DealLoanInfo.CodeYear = strCode[2];
                this.DealLoanInfo.ContractCode = strCode[3];
            }
            else
            {
                this.DealLoanInfo.CodeYear = varDate.getFullYear().toString().substring(2);
                this.DealLoanInfo.ContractCode = strCode[0];
            }
            var myDate = new Date();
            if(this.DealLoanInfo.EvaluateFeeDate==undefined || this.DealLoanInfo.EvaluateFeeDate=="")
            {
                this.DealLoanInfo.EvaluateFeeDate = getDate(myDate);
            }
            if(this.DealLoanInfo.AgencyFeeDate==undefined || this.DealLoanInfo.AgencyFeeDate=="")
            {
                this.DealLoanInfo.AgencyFeeDate = getDate(myDate);
            }
            if(this.DealLoanInfo.LoanContractDate==undefined || this.DealLoanInfo.LoanContractDate=="")
            {
                this.DealLoanInfo.LoanContractDate = getDate(myDate);
            }
        }
    },
    initComboVal:function(){
        var jsonInitVal = {};
        if( this.DealLoanInfo != undefined ){
            jsonInitVal.CompleteYear = this.DealLoanInfo.CompleteYear;
            jsonInitVal.LoanInfo = this.DealLoanInfo.LoanInfo;
            jsonInitVal.ReceiveBank = this.DealLoanInfo.ReceiveBank;
            jsonInitVal.OrderPlace = this.DealLoanInfo.OrderPlace;
            jsonInitVal.EmpCompanyId = this.DealLoanInfo.EmpCompanyId;
            jsonInitVal.EmpDepartId = this.DealLoanInfo.EmpDepartId;
            jsonInitVal.EmployeeId = this.DealLoanInfo.EmployeeId;
        }else{
            jsonInitVal.CompleteYear = "__/__/__";
            jsonInitVal.LoanInfo = "请选择";
            jsonInitVal.ReceiveBank = "请选择";
            jsonInitVal.OrderPlace = "请选择";
            jsonInitVal.BargainCompanyId = "请选择";
            jsonInitVal.EmpCompanyId = "请选择";
            jsonInitVal.EmpDepartId = "请选择";
            jsonInitVal.EmployeeId = "请选择";
        }
        return jsonInitVal;
    },
    loadDefVal:function(){
        //预审信息
        var strComCode = "";
        if(this.DealLoanInfo != undefined ){
            //绑定预审信息
            if(this.DealLoanInfo.EmpCompanyName !=undefined & this.DealLoanInfo.EmpCompanyName != "")
            {
                switch (this.DealLoanInfo.EmpCompanyName)
                    {
                        case "上海臣信":
                            strComCode = "M-CXSH";
                            break;
                        case "杭州臣信":
                            strComCode = "M-CXHZ";
                            break;
                        case "武汉臣信":
                            strComCode = "M-CXWH";
                            break;
                        case "昆山臣信":
                            strComCode = "M-CXKS";
                            break;
                        case "长春臣信":
                            strComCode = "M-CXCC";
                            break;
                        case "南京臣信":
                            strComCode = "M-CXNJ";
                            break;
                        case "苏州臣信":
                            strComCode = "M-CXSZ";
                            break;
                    }
                this.DealLoanInfo.ComCode = strComCode;
            }
            Chenxin.Fn.setFormValue(this.id,this.comboList,this.DealLoanInfo);
        }
        else
        {
            $("#ComCode").val("M-CXSH");
        }

        //贷款人信息
        if(this.PreBuyerInfo != undefined){
            //绑定贷款人信息
            Chenxin.Fn.setFormValue(this.id,{},this.PreBuyerInfo);
        }
        
        var strJson = "";
        //是否缺件
        $("#tbSl tr").each(function(){
           var trJson={};
           $(this).find("input").each(function(){
               //单选框
               if(this.type.toLowerCase() == "radio"){
                   //被选中
                   if($(this).attr("checked")){
                       trJson[this.name] = true;
                   }else{
                       trJson[this.name] = false;
                   }
               }
           });
           strJson = trJson.toString();
           if(strJson == "{IsLack:\"true\"}"){
                $('#tr_LackInfo').show();
            }
        });
    },
    manualPreCheck:function(){
    
        var bRet = true;
        var strJson = ""
        
        //是否缺件
        $("#tbSl tr").each(function(){
           var trJson={};
           $(this).find("input").each(function(){
               //单选框
               if(this.type.toLowerCase() == "radio"){
                   //被选中
                   if($(this).attr("checked")){
                       trJson[this.name] = true;
                   }else{
                       trJson[this.name] = false;
                   }
               }
           });

           if(trJson.toString() != "{}")
           {
               strJson = trJson.toString();
           }
           if(strJson == "{IsLack:\"true\"}"){
               var objLackInfo = $(this).find("input[name=LackInfo]:eq(0)");
               if( objLackInfo.val() == ""){
                   alert("请输入缺件内容！");
                   objLackInfo.focus();
                   bRet =  false;
                   return false;
               }
            }
        });
        return bRet;
    },
    initEvent:function(){
        /*************事件：收件收据控制*************/
        $("input[name='IsLack']").click(function () {
            $('#tr_LackInfo')[this.value=="true"?'show':'hide']();
//            if(this.value=="false")
//            {
//                $("#tr_LackInfo").unFormValidator(false);
//            }
//            else
//            {
//                $("#tr_LackInfo").unFormValidator(true);
//            }
        });
        /*************事件：校验成交编号*************/
        $('#btn_chkCode').click(function(){		
		    var _prefix=$('#ComCode').val();
		    var _year=$('#CodeYear').val();
		    var _code=$('#ContractCode').val();
		    if(!_code)
		    {
			    alert('请输入成交编号！');
			    return;
		    }
		    Chenxin.Msg.Waiting.show();
            Chenxin.ajax({
                type: "post",
                dataType: "text",
                paramType: 'json',
                async:false,
                url: '/service/logic/DealLoan.ashx',
                data:{op: 'chkcode', prefix:_prefix,year:_year,code:_code},
                onSuccess: function(data, msg) {
				    Chenxin.Msg.Waiting.hide();
				    if(data)
				    {
					    if($('#Address').val() != data.Address)
					    {
					        if(confirm('房源编号获取地址：'+ data.Address + '，与当前地址不同！'))
					        {
			                    $('#Address').val(data.Address);
			                    $('#txtBuyerPhone').val(data.BuyerPhone);
			                    $('#txtSalerPhone').val(data.SalerPhone);
			                }
					    }
					    else
					    {
					        alert('数据匹配！');
					        $('#txtBuyerPhone').val(data.BuyerPhone);
			                $('#txtSalerPhone').val(data.SalerPhone);
					    }
				    }
                },
			    onFail:function(){
				    Chenxin.Msg.Waiting.hide();			
			    },
			    onWrong:function(){
				    Chenxin.Msg.Waiting.hide();		
			    },
			    onError:function(){
				    Chenxin.Msg.Waiting.hide();			
			    }
            });
		});
        /*************事件：只输入数字*************/
        $("input[name='CodeYear']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 8)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='ContractCode']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 8)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='EstimatePrice']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='BuildingArea']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 8)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='Total_Floor']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 8)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='GJJmoney']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='SYMoney']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='LoanXf']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='LoanSx']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='LoanZy']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='EvaluateFee']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='VouchFee']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='AgencyFee']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='OutVouchFee']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='InsuranceFee']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='LoanBankSaleComplete']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='OldRestMoney']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("input[name='OldLoanMoney']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
    }
});

getcity = true; //设置需要获取城市下拉框数据

$(document).ready(function(){
    var objPage = new Chenxin.UI.DealLoanPage();
});